<template>
  <div class="chat-room">
    <UserList v-if="active === 0" />
    <van-tabbar v-model="active" class="tabbar">
      <van-tabbar-item icon="friends-o">在线用户</van-tabbar-item>
      <van-tabbar-item icon="wap-home-o" :to="`/room`" @click="toChatRoom">聊天室</van-tabbar-item>
    </van-tabbar>
  </div>
</template>
<script>
import UserList from './user-list.vue'
// import { mapState } from 'vuex'
export default {
  name: 'ChatRoom',
  components: { UserList },
  data() {
    return {
      active: 0
    }
  },
  computed: {
    // ...mapState(['userInfo'])
  },
  mounted() {},
  methods: {
    toChatRoom() {
      this.$socket.emit('toChatRoom')
    }
  }
}
</script>
<style lang="less" scoped>
.chat-room {
  width: 100%;
  height: 100vh;
  background-image: url('~@/assets/images/22.jpeg');
  background-size: cover;
  /deep/ .van-tabbar,
  .van-tabbar-item,
  .van-tabbar-item--active {
    background-color: rgba(255, 255, 255, 0.438);
  }
}
</style>
